<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [1, 2];
        var bbb = [{
            id: 1,
            name: '张三'
        }, {
            id: 2,
            name: '张三'
        }, {
            id: 3,
            name: '张三'
        }, {
            id: 4,
            name: '张三'
        }]
        let aaa = bbb.filter(item => {
            return arr.includes(item.id)
        })
        console.log(aaa);
    </script>
</body>

</html>